## ######################################################################
##            ___   ___    _  _  ___ _____   ___ ___ ___ _____
##           |   \ / _ \  | \| |/ _ \_   _| | __|   \_ _|_   _|
##           | |) | (_) | | .` | (_) || |   | _|| |) | |  | |
##           |___/ \___/  |_|\_|\___/ |_|   |___|___/___| |_|
##            _____ _  _ ___ ___   ___ ___ _    ___ _
##           |_   _| || |_ _/ __| | __|_ _| |  | __| |
##             | | | __ || |\__ \ | _| | || |__| _||_|
##             |_| |_||_|___|___/ |_| |___|____|___(_)
##
## This is a generated file. Please edit the corresponding template
## file (example: templates/gpdb-tpl.yml) and regenerate the pipeline
## using appropriate tool (example: gen_pipeline.py -t prod).
## ----------------------------------------------------------------------
## Generated by gen_pipeline.py at: 2023-09-06 12:50:28.297086
## Template file: gpdb-tpl.yml
## OS Types: 
## Test Sections: ['icw', 'cli', 'aa', 'release']
## ======================================================================

## ======================================================================
##                   _
##   __ _ _ __   ___| |__   ___  _ __ ___
##  / _` | '_ \ / __| '_ \ / _ \| '__/ __|
## | (_| | | | | (__| | | | (_) | |  \__ \
##  \__,_|_| |_|\___|_| |_|\___/|_|  |___/
## ======================================================================
## NOTE: only one anchors section is allowed per file, so we define this
##  at the top of the file so anchors are usable as early as possible.
anchors:
- &default_platform
  PLATFORM: rocky8-gpdb6

- &ccp_default_params
  action: create
  delete_on_failure: true
  generate_random_name: true
  plugin_dir: ../../terraform.d/plugin-cache/linux_amd64
  terraform_source: ccp_src/google/

- &ccp_default_vars
  instance_type: n1-standard-1
  <<: *default_platform

- &destroy_common
  action: destroy
  plugin_dir: ../../terraform.d/plugin-cache/linux_amd64
  terraform_source: ccp_src/google/
  vars:
    aws_instance-node-instance_type: t2.micro #t2.micro is ignored in destroy, but aws_instance-node-instance_type is required.
    aws_ebs_volume_type: standard

- &ccp_destroy
  put: terraform
  params:
    <<: *destroy_common
    env_name_file: terraform/name
  get_params:
    action: destroy

- &ccp_destroy_two_clusters
  in_parallel:
    - put: terraform_1
      params:
        <<: *destroy_common
        env_name_file: terraform_1/name
      get_params:
        action: destroy
    - put: terraform_2
      params:
        <<: *destroy_common
        env_name_file: terraform_2/name
      get_params:
        action: destroy

- &ccp_gen_cluster_default_params
  AWS_ACCESS_KEY_ID: ((tf-machine-access-key-id))
  AWS_SECRET_ACCESS_KEY: ((tf-machine-secret-access-key))
  AWS_DEFAULT_REGION: ((aws-region))
  BUCKET_PATH: clusters-google/
  BUCKET_NAME: ((tf-bucket-name))
  CLOUD_PROVIDER: google
  <<: *default_platform

- &set_failed
  do:
    - task: on_failure_set_failed
      config:
        platform: linux
        image_resource:
          type: registry-image
          source:
            repository: gcr.io/data-gpdb-public-images/ccp
            tag: "latest"
        inputs:
          - name: ccp_src
          - name: terraform
        run:
          path: 'ccp_src/google/ccp_failed_test.sh'
        params:
          GOOGLE_CREDENTIALS: ((google-service-account-key/prod))
          GOOGLE_PROJECT_ID: ((google-project-id))
          GOOGLE_ZONE: ((google-zone))
          GOOGLE_SERVICE_ACCOUNT: ((google-service-account/prod))
          AWS_ACCESS_KEY_ID: ((tf-machine-access-key-id))
          AWS_SECRET_ACCESS_KEY: ((tf-machine-secret-access-key))
          AWS_DEFAULT_REGION: ((tf-machine-region))
          BUCKET_PATH: clusters-google/
          BUCKET_NAME: ((tf-bucket-name))

- &set_failed_two_clusters_common
  platform: linux
  image_resource:
    type: registry-image
    source:
      repository: gcr.io/data-gpdb-public-images/ccp
      tag: "latest"
  run:
    path: 'ccp_src/google/ccp_failed_test.sh'
  params:
    GOOGLE_CREDENTIALS: ((google-service-account-key/prod))
    GOOGLE_PROJECT_ID: ((google-project-id))
    GOOGLE_ZONE: ((google-zone))
    GOOGLE_SERVICE_ACCOUNT: ((google-service-account/prod))
    AWS_ACCESS_KEY_ID: ((tf-machine-access-key-id))
    AWS_SECRET_ACCESS_KEY: ((tf-machine-secret-access-key))
    AWS_DEFAULT_REGION: ((tf-machine-region))
    BUCKET_PATH: clusters-google/
    BUCKET_NAME: ((tf-bucket-name))

- &terraform_cluster
  type: terraform
  source:
    env:
      AWS_ACCESS_KEY_ID: ((tf-machine-access-key-id))
      AWS_SECRET_ACCESS_KEY: ((tf-machine-secret-access-key))
      GOOGLE_CREDENTIALS: ((google-service-account-key/prod))
    vars:
      project_id: ((google-project-id))
    storage:
      access_key_id: ((tf-machine-access-key-id))
      secret_access_key: ((tf-machine-secret-access-key))
      region_name: ((aws-region))
      # This is not parameterized, on purpose. All tfstates will go to this spot,
      # and different teams will place there clusters' tfstate files under different paths
      bucket: gpdb5-pipeline-dynamic-terraform
      bucket_path: clusters-google/

- &set_failed_two_clusters
  in_parallel:
    - task: on_failure_set_failed-1
      config:
        <<: *set_failed_two_clusters_common
        inputs:
          - name: ccp_src
          - name: terraform_1
    - task: on_failure_set_failed-2
      config:
        <<: *set_failed_two_clusters_common
        inputs:
          - name: ccp_src
          - name: terraform_2

## ======================================================================
##   __ _ _ __ ___  _   _ _ __  ___
##  / _` | '__/ _ \| | | | '_ \/ __|
## | (_| | | | (_) | |_| | |_) \__ \
##  \__, |_|  \___/ \__,_| .__/|___/
##  |___/                |_|
## ======================================================================

groups:
- name: all
  jobs:
  - gate_compile_start
  - compile_gpdb_rocky8
  - prepare_binary_swap_gpdb_rocky8
  - test_gpdb_clients_rocky8
  - publish_server_builds
  - check_format
  - compile_gpdb_sles12
  - test_gpdb_clients_sles12
  - compile_gpdb_clients_windows
  - test_gpdb_clients_windows
  - gate_compile_end
  ## --------------------------------------------------------------------
  - gate_icw_start
  - icw_gporca_rocky8
  - icw_planner_rocky8
  - icw_gporca_icproxy_rocky8
  - icw_planner_icproxy_rocky8
  - icw_planner_ictcp_rocky8
  - icw_mirrorless_rocky8
  - icw_gporca_memory_rocky8
  # Not support enable fips on ubuntu20.04
  - fips_rocky8
  - unit_tests_gporca_rocky8
  - gpdb_pitr_rocky8
  - interconnect_rocky8
  - icw_extensions_gpcloud_rocky8
  - gpexpand_rocky8
  - pg_upgrade_rocky8
  - gate_icw_end

  ## --------------------------------------------------------------------
  - gate_cli_start
  - cli_cross_subnet_rocky8
  - gpmovemirrors_rocky8
  - gppkg_rocky8
  - analyzedb_rocky8
  - gpreload_rocky8
  - gpinitsystem_rocky8
  - gpstate_rocky8
  - replication_slots_rocky8
  - gpactivatestandby_rocky8
  - gpinitstandby_rocky8
  - gp_bash_functions.sh_rocky8
  - gpcheckcat_rocky8
  - gpcheckperf_rocky8
  - gprecoverseg_rocky8
  - gprecoverseg_newhost_rocky8
  - gpaddmirrors_rocky8
  - gpconfig_rocky8
  - gpssh-exkeys_rocky8
  - gpstart_rocky8
  - gpstop_rocky8
  - check_rocky8
  - resource_group_rocky8
  - gate_cli_end

  ## --------------------------------------------------------------------
  - gate_advanced_analytics_start
  - madlib_build_gppkg_rocky8
  - madlib_test_orca_rocky8
  - madlib_test_planner_rocky8
  - gate_advanced_analytics_end


## ======================================================================
- name: release
  jobs:
  - gate_icw_end
  - gate_cli_end
  - gate_advanced_analytics_end
  - gate_release_candidate_start
  - release_candidate

  - build_release_candidate_rpms


## ======================================================================

- name: compile
  jobs:
  - gate_compile_start
  - compile_gpdb_rocky8
  - prepare_binary_swap_gpdb_rocky8
  - test_gpdb_clients_rocky8
  - publish_server_builds
  - check_format
  - compile_gpdb_sles12
  - test_gpdb_clients_sles12
  - compile_gpdb_clients_windows
  - test_gpdb_clients_windows
  - gate_compile_end

## ======================================================================

- name: icw
  jobs:
  - gate_compile_end
  - gate_icw_start
  - icw_gporca_rocky8
  - icw_planner_rocky8
  - icw_gporca_icproxy_rocky8
  - icw_planner_icproxy_rocky8
  - icw_planner_ictcp_rocky8
  - icw_mirrorless_rocky8
  - icw_gporca_memory_rocky8
  # Not support enable fips on ubuntu20.04
  - fips_rocky8
  - unit_tests_gporca_rocky8
  - gpdb_pitr_rocky8
  - interconnect_rocky8
  - icw_extensions_gpcloud_rocky8
  - gpexpand_rocky8
  - pg_upgrade_rocky8
  - gate_icw_end

## ======================================================================

- name: cli
  jobs:
  - gate_compile_end
  - gate_cli_start
  - cli_cross_subnet_rocky8
  - gpmovemirrors_rocky8
  - gppkg_rocky8
  - analyzedb_rocky8
  - gpreload_rocky8
  - gpinitsystem_rocky8
  - gpstate_rocky8
  - replication_slots_rocky8
  - gpactivatestandby_rocky8
  - gpinitstandby_rocky8
  - gp_bash_functions.sh_rocky8
  - gpcheckcat_rocky8
  - gpcheckperf_rocky8
  - gprecoverseg_rocky8
  - gprecoverseg_newhost_rocky8
  - gpaddmirrors_rocky8
  - gpconfig_rocky8
  - gpssh-exkeys_rocky8
  - gpstart_rocky8
  - gpstop_rocky8
  - check_rocky8
  - resource_group_rocky8
  - gate_cli_end

- name: advancedanalytics
  jobs:
  - gate_compile_end
  - gate_advanced_analytics_start
  - madlib_build_gppkg_rocky8
  - madlib_test_orca_rocky8
  - madlib_test_planner_rocky8
  - gate_advanced_analytics_end

## ======================================================================
##                                           _
##  _ __ ___  ___  ___  _   _ _ __ ___ ___  | |_ _   _ _ __   ___  ___
## | '__/ _ \/ __|/ _ \| | | | '__/ __/ _ \ | __| | | | '_ \ / _ \/ __|
## | | |  __/\__ \ (_) | |_| | | | (_|  __/ | |_| |_| | |_) |  __/\__ \
## |_|  \___||___/\___/ \__,_|_|  \___\___|  \__|\__, | .__/ \___||___/
##                                               |___/|_|
## ======================================================================

resource_types:
- name: terraform
  type: registry-image
  source:
    repository: ljfranklin/terraform-resource
    tag: 0.11.14
- name: gcs
  type: registry-image
  source:
    repository: frodenas/gcs-resource
- name: pivnet
  type: registry-image
  source:
    repository: pivotalcf/pivnet-resource
    tag: latest-final
## ======================================================================
##  _ __ ___  ___  ___  _   _ _ __ ___ ___  ___
## | '__/ _ \/ __|/ _ \| | | | '__/ __/ _ \/ __|
## | | |  __/\__ \ (_) | |_| | | | (_|  __/\__ \
## |_|  \___||___/\___/ \__,_|_|  \___\___||___/
## ======================================================================

resources:
#used in test_gpdb_clients_windows and the job only created when os_type == default_os_type
# also used in icw and cli section jobs
- name: ccp_src
  type: git
  source:
    branch: ((gp-concourse-cluster-provisioner-git-branch))
    private_key: ((gp-concourse-cluster-provisioner-git-key))
    uri: ((gp-concourse-cluster-provisioner-git-remote))

- name: terraform.d
  source:
    access_key_id: ((aws-bucket-access-key-id))
    bucket: ccp-terraform-provider-plugins
    region_name: ((aws-region))
    secret_access_key: ((aws-bucket-secret-access-key))
    versioned_file: plugin-cache.tgz
  type: s3
- name: terraform
  <<: *terraform_cluster

- name: ccp-image
  type: registry-image
  source:
    repository: gcr.io/data-gpdb-public-images/ccp
    tag: 'latest'

- name: terraform_1
  <<: *terraform_cluster

- name: terraform_2
  <<: *terraform_cluster

- name: alpine-docker
  type: registry-image
  source:
    repository: alpine
    tag: latest

- name: icw_planner_rocky8_dump
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/icw_planner_rocky8_dump/dump.sql.xz

- name: gpdb_src
  type: git
  source:
    branch: ((gpdb-git-branch))
    uri: ((gpdb-git-remote))
    ignore_paths:
    - gpdb-doc/*
    - README*


- name: previous_gpdb
  type: pivnet
  source:
    api_token: ((pivotal-gpdb-pivnet-api-token))
    product_slug: pivotal-gpdb
    product_version: ((pivotal-gpdb-pivnet-product-version))


   # for os_type oel8 and rhel8, gpdb6-oel8-build and gpdb6-rhel8-build is only used in icw job: unit_tests_gporca_rocky8
- name: gpdb6-rocky8-build
  type: registry-image
  source:
    tag: latest
    repository: gcr.io/data-gpdb-public-images/gpdb6-rocky8-build


- name: gpdb6-rocky8-test
  type: registry-image
  source:
    tag: latest
    repository: gcr.io/data-gpdb-public-images/gpdb6-rocky8-test
- name: gpdb6-sles12-build
  type: registry-image
  source:
    repository: gcr.io/data-gpdb-private-images/gpdb6-sles12-build
    tag: latest
    username: _json_key
    password: ((data-gpdb-private-images-container-registry-readonly-service-account-key))
- name: bin_gpdb
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/bin_gpdb/bin_gpdb.tar.gz

- name: bin_gpdb_clients
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/bin_gpdb_clients/bin_gpdb_clients.tar.gz



- name: bin_gpdb_icw_green
  type: s3
  source:
    access_key_id: ((aws-bucket-access-key-id))
    bucket: ((aws-bucket))
    region_name: ((aws-region))
    secret_access_key: ((aws-bucket-secret-access-key))
    versioned_file: bin_gpdb/gpdb_branch_6X_STABLE/icw_green/bin_gpdb.tar.gz


- name: bin_gpdb_clients_rocky8_rc
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: clients/published/gpdb6/clients-rc-(.*)-rhel8_x86_64((rc-build-type-gcs)).tar.gz

- name: bin_gpdb_clients_sles12_rc
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: clients/published/gpdb6/clients-rc-(.*)-sles12_x86_64((rc-build-type-gcs)).tar.gz

- name: server_src_rc
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: server-src/published/gpdb6/server-src-rc-*.tar.gz

- name: bin_gpdb_rocky8_rc
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: server/published/gpdb6/server-rc-(.*)-rhel8_x86_64((rc-build-type-gcs)).tar.gz

- name: bin_gpdb_centos7_rc
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: server/published/gpdb6/server-rc-(.*)-rhel7_x86_64((rc-build-type-gcs)).tar.gz

- name: gpdb_rpm_installer_rocky8
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: server/published/gpdb6/greenplum-db-(.*)-rhel8-x86_64((rc-build-type-gcs)).rpm

- name: greenplum-database-release
  type: git
  icon: git
  source:
    branch: main
    uri: https://github.com/greenplum-db/greenplum-database-release.git

- name: license_file
  type: gcs
  icon: google
  source:
    bucket: ((gcs-bucket-for-oss))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: osl/released/gpdb6/open_source_license_greenplum-database-6.0.0-97773a0-(.*).txt


- name: binary_swap_gpdb_rocky8
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/binary_swap_gpdb_rocky8/bin_gpdb.tar.gz

- name: server-build-rocky8
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: server/published/gpdb6/server-build-(.*)-rhel8_x86_64((rc-build-type-gcs)).tar.gz

- name: bin_gpdb_sles12
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/bin_gpdb_sles12/bin_gpdb.tar.gz

- name: bin_gpdb_clients_sles12
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/bin_gpdb_clients_sles12/bin_gpdb_clients.tar.gz

- name: bin_gpdb_clients_windows
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/bin_gpdb_clients_windows/greenplum-clients-x86_64.tar.gz

- name: terraform_windows
  type: terraform
  source:
    env:
      AWS_ACCESS_KEY_ID: ((tf-machine-access-key-id))
      AWS_SECRET_ACCESS_KEY: ((tf-machine-secret-access-key))
      GOOGLE_CREDENTIALS: ((google-service-account-key/prod))
    vars:
      project: ((google-project-id))
      region: ((google-region))
      region_zone: ((google-zone))
    storage:
      access_key_id: ((tf-machine-access-key-id))
      secret_access_key: ((tf-machine-secret-access-key))
      region_name: ((aws-region))
      # This is not parameterized, on purpose. All tfstates will go to this spot,
      # and different teams will place there clusters' tfstate files under different paths
      bucket: gpdb5-pipeline-dynamic-terraform
      bucket_path: gp-clients-windows-tests-google/

- name: bin_gpdb_clients_windows_rc
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: clients/published/gpdb6/clients-rc-*-windows_x86_64((rc-build-type-gcs)).msi
- name: madlib_src
  type: git
  source:
    branch: ((madlib-git-branch))
    tag_filter: ((madlib-git-tag-filter))
    uri: ((madlib-git-remote))

- name: madlib_ci
  type: git
  source:
    tag_filter: ((madlib-ci-tag-filter))
    uri: ((madlib-ci-git-remote))
    private_key: ((madlib-ci-git-key))
- name: madlib_gppkg_rocky8
  type: gcs
  source:
    bucket: ((gcs-bucket-intermediates))
    json_key: ((concourse-gcs-resources-service-account-key))
    versioned_file: ((pipeline-name))/madlib_gppkg/madlib-master-gp6-rocky8-x86_64.gppkg
- name: cmake_tar
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: gp-internal-artifacts/madlib-snowflakes/cmake-(3.5.2)-Linux-x86_64.tar.gz

- name: pyxb
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: gp-internal-artifacts/madlib-snowflakes/PyXB-(1.2.6).tar.gz

- name: eigen
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: gp-internal-artifacts/madlib-snowflakes/(3.2).tar.gz

- name: boost
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: gp-internal-artifacts/madlib-snowflakes/boost_(1_61_0).tar.gz

- name: postgres_for_fdw
  type: gcs
  source:
    bucket: ((gcs-bucket))
    json_key: ((concourse-gcs-resources-service-account-key))
    regexp: gp-internal-artifacts/postgres-fdw-dependencies/postgresql-(10.4).tar.gz


## ======================================================================
##    _       _
##   (_) ___ | |__  ___
##   | |/ _ \| '_ \/ __|
##   | | (_) | |_) \__ \
##  _/ |\___/|_.__/|___/
## |__/
## ======================================================================

jobs:

## ======================================================================
##  ____  _            _ _              _   _       _ _     _____         _
## |  _ \(_)_ __   ___| (_)_ __   ___  | | | |_ __ (_) |_  |_   _|__  ___| |_ ___
## | |_) | | '_ \ / _ \ | | '_ \ / _ \ | | | | '_ \| | __|   | |/ _ \/ __| __/ __|
## |  __/| | |_) |  __/ | | | | |  __/ | |_| | | | | | |_    | |  __/\__ \ |_\__ \
## |_|   |_| .__/ \___|_|_|_| |_|\___|  \___/|_| |_|_|\__|   |_|\___||___/\__|___/
##         |_|
## ======================================================================


## ======================================================================
##   ____                      _ _
##  / ___|___  _ __ ___  _ __ (_) | ___
## | |   / _ \| '_ ` _ \| '_ \| | |/ _ \
## | |__| (_) | | | | | | |_) | | |  __/
##  \____\___/|_| |_| |_| .__/|_|_|\___|
##                      |_|
## ======================================================================

- name: gate_compile_start
  plan:
    - get: gpdb_src
      params:
        skip_download: 'true'
      trigger: true

- name: check_format
  plan:
    - get: gpdb_src
      trigger: true
      passed: [gate_compile_start]
    - task: check_format
      file: gpdb_src/concourse/tasks/check_format.yml

- name: compile_gpdb_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        passed:
          - check_format
        trigger: true
      - get: gpdb6-rocky8-build
  - task: compile_gpdb
    file: gpdb_src/concourse/tasks/compile_gpdb.yml
    image: gpdb6-rocky8-build
    params:
      CONFIGURE_FLAGS: ((configure_flags_with_extensions))
      BLD_TARGETS: "clients"
      RC_BUILD_TYPE_GCS: ((rc-build-type-gcs))
  - in_parallel:
      steps:
      - put: bin_gpdb
        params:
          file: gpdb_artifacts/bin_gpdb.tar.gz
      - put: bin_gpdb_clients
        params:
          file: gpdb_artifacts/bin_gpdb_clients.tar.gz

- name: prepare_binary_swap_gpdb_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [compile_gpdb_rocky8]
      - get: gpdb_package
        resource: previous_gpdb
        params:
          globs: [greenplum-db-6*-rhel8-x86_64.rpm]
      - get: gpdb6-rocky8-build
  - task: generate_previous_bin_gpdb
    file: gpdb_src/concourse/tasks/extract_package.yml
    image: gpdb6-rocky8-build
  - put: binary_swap_gpdb_rocky8
    params:
      file: gpdb_artifacts/bin_gpdb.tar.gz

- name: test_gpdb_clients_rocky8
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            passed: [compile_gpdb_rocky8]
          - get: bin_gpdb
            passed: [compile_gpdb_rocky8]
          - get: bin_gpdb_clients
            passed: [compile_gpdb_rocky8]
          - get: gpdb6-rocky8-test
    - task: run_tests
      image: gpdb6-rocky8-test
      file: gpdb_src/concourse/tasks/test_gpdb_clients.yml

- name: compile_gpdb_sles12
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          passed:
            - check_format
        - get: gpdb6-sles12-build
    - task: compile_gpdb
      image: gpdb6-sles12-build
      file: gpdb_src/concourse/tasks/compile_gpdb.yml
      params:
        CONFIGURE_FLAGS: {{configure_flags_with_extensions}}
        TARGET_OS: sles
        TARGET_OS_VERSION: "12"
        BLD_TARGETS: "clients"
        RC_BUILD_TYPE_GCS: ((rc-build-type-gcs))
    - in_parallel:
        steps:
        - put: bin_gpdb_sles12
          params:
            file: gpdb_artifacts/bin_gpdb.tar.gz
        - put: bin_gpdb_clients_sles12
          params:
            file: gpdb_artifacts/bin_gpdb_clients.tar.gz

- name: test_gpdb_clients_sles12
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            passed: [compile_gpdb_sles12]
          - get: bin_gpdb
            resource: bin_gpdb_sles12
            passed: [compile_gpdb_sles12]
          - get: bin_gpdb_clients
            resource: bin_gpdb_clients_sles12
            passed: [compile_gpdb_sles12]
          - get: gpdb6-sles12-build
    - task: run_tests
      image: gpdb6-sles12-build
      file: gpdb_src/concourse/tasks/test_gpdb_clients.yml

- name: compile_gpdb_clients_windows
  serial: true
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        passed: [check_format]
        trigger: true
      - get: gpdb6-rocky8-build
  - task: compile_gpdb_windows_remote
    file: gpdb_src/concourse/tasks/compile_gpdb_remote_windows.yml
    image: gpdb6-rocky8-build
    params:
      REMOTE_HOST: ((remote_win_host_build))
      REMOTE_PORT: ((remote_win_port_build))
      REMOTE_USER: ((remote_win_user_build))
      REMOTE_KEY: ((remote_win_key_build))
  - put: bin_gpdb_clients_windows
    params:
      file: "gpdb_artifacts/greenplum-clients-x86_64.tar.gz"

- name: test_gpdb_clients_windows
  plan:
  - in_parallel:
      steps:
      - get: ccp_src
      - get: gpdb_src
        trigger: true
        passed: [compile_gpdb_clients_windows]
      - get: bin_gpdb_clients_windows
        passed: [compile_gpdb_clients_windows]
      - get: bin_gpdb
        resource: bin_gpdb_centos7_rc
      - get: terraform.d
        params:
          unpack: true
  - put: terraform_windows
    params:
      action: create
      delete_on_failure: true
      generate_random_name: true
      plugin_dir: ../../terraform.d/plugin-cache/linux_amd64
      terraform_source: ccp_src/gpdb_windows_client_test/
  - task: run_tests
    file: gpdb_src/concourse/tasks/windows_remote_test.yml
    params:
      REMOTE_PORT: ((remote_win_port_test))
      REMOTE_USER: ((remote_win_user_test))
      REMOTE_KEY: ((remote_win_key_test))
  ensure:
    put: terraform_windows
    params:
      action: destroy
      plugin_dir: ../../terraform.d/plugin-cache/linux_amd64
      env_name_file: terraform_windows/name
      terraform_source: ccp_src/gpdb_windows_client_test/
      vars:
        aws_instance-node-instance_type: t2.micro #t2.micro is ignored in destroy, but aws_instance-node-instance_type is required.
        aws_ebs_volume_type: standard
    get_params:
      action: destroy
- name: publish_server_builds
  old_name: Publish Server Builds
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed:
        - compile_gpdb_rocky8
      - get: bin_gpdb
        passed: [compile_gpdb_rocky8]
      - get: gpdb6-rocky8-build
  - task: rename_server_build_artifacts
    image: gpdb6-rocky8-build
    config:
      platform: linux
      inputs:
        - name: gpdb_src
        - name: bin_gpdb
      outputs:
        - name: output
      params:
        RC_BUILD_TYPE_GCS: ((rc-build-type-gcs))
      run:
        path: bash
        args:
          - -exc
          - |
            server_version="$(./gpdb_src/getversion --short)"
            cp bin_gpdb/bin_gpdb.tar.gz "output/server-build-${server_version}-rhel8_x86_64${RC_BUILD_TYPE_GCS}.tar.gz"
  - in_parallel:
    - put: server-build-rocky8
      params:
        file: output/server-build-*-rhel8*.tar.gz

- name: gate_compile_end
  plan:
    - get: gpdb_src
      trigger: true
      params:
        skip_download: 'true'
      passed:
        - prepare_binary_swap_gpdb_rocky8
        - test_gpdb_clients_rocky8
        - publish_server_builds
        - test_gpdb_clients_sles12
        - test_gpdb_clients_windows
    - get: bin_gpdb
      params:
        skip_download: 'true'
      passed:
      - test_gpdb_clients_rocky8
      - publish_server_builds
    - get: bin_gpdb_clients
      params:
        skip_download: 'true'
      passed: [test_gpdb_clients_rocky8]
    - get: binary_swap_gpdb_rocky8
      params:
        skip_download: 'true'
      passed: [ prepare_binary_swap_gpdb_rocky8 ]
    - get: server-build-rocky8
      params:
        skip_download: 'true'
      passed: [publish_server_builds]
    - get: bin_gpdb_sles12
      params:
        skip_download: 'true'
      passed: [ test_gpdb_clients_sles12 ]
    - get: bin_gpdb_clients_sles12
      params:
        skip_download: 'true'
      passed: [ test_gpdb_clients_sles12 ]
    - get: bin_gpdb_clients_windows
      params:
        skip_download: 'true'
      passed: [ test_gpdb_clients_windows ]


## ======================================================================
##  ___ ______        __
## |_ _/ ___\ \      / /
##  | | |    \ \ /\ / /
##  | | |___  \ V  V /
## |___\____|  \_/\_/
## ======================================================================

- name: gate_icw_start
  plan:
    - get: gpdb_src
      trigger: true
      params:
        skip_download: 'true'
      passed: [ gate_compile_end ]
    - get: bin_gpdb
      params:
        skip_download: 'true'
      passed: [ gate_compile_end ]
    - get: binary_swap_gpdb_rocky8
      params:
        skip_download: 'true'
      passed: [ gate_compile_end ]
    - get: bin_gpdb_clients
      params:
        skip_download: 'true'
      passed: [ gate_compile_end ]
    - get: bin_gpdb_sles12
      params:
        skip_download: 'true'
      passed: [ gate_compile_end ]
    - get: bin_gpdb_clients_sles12
      params:
        skip_download: 'true'
      passed: [ gate_compile_end ]
    - get: bin_gpdb_clients_windows
      params:
        skip_download: 'true'
      passed: [ gate_compile_end ]


- name: icw_planner_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_icw_start]
      - get: bin_gpdb
        passed: [gate_icw_start]
      - get: binary_swap_gpdb
        passed: [gate_icw_start]
        resource: binary_swap_gpdb_rocky8
      - get: postgres_for_fdw
        params:
          unpack: true
      - get: gpdb6-rocky8-test
  - task: ic_gpdb
    tags: [icw-worker]
    file: gpdb_src/concourse/tasks/ic_gpdb_binary_swap.yml
    image: gpdb6-rocky8-test
    timeout: 24h
    params:
      MAKE_TEST_COMMAND: -k PGOPTIONS='-c optimizer=off' installcheck-world
      TEST_OS: centos
      TEST_BINARY_SWAP: ((test-binary-swap))
      CONFIGURE_FLAGS: ((configure_flags))
      DUMP_DB: "true"
  - put: icw_planner_rocky8_dump
    params:
      file: sqldump/dump.sql.xz

- name: icw_gporca_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_icw_start]
      - get: bin_gpdb
        passed: [gate_icw_start]
      - get: postgres_for_fdw
        params:
          unpack: true
      - get: gpdb6-rocky8-test
  - task: ic_gpdb
    tags: [icw-worker]
    file: gpdb_src/concourse/tasks/ic_gpdb.yml
    image: gpdb6-rocky8-test
    timeout: 24h
    params:
      MAKE_TEST_COMMAND: -k PGOPTIONS='-c optimizer=on' installcheck-world
      TEST_OS: centos
      CONFIGURE_FLAGS: ((configure_flags))

- name: icw_planner_icproxy_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_icw_start]
      - get: bin_gpdb
        passed: [gate_icw_start]
      - get: postgres_for_fdw
        params:
          unpack: true
      - get: gpdb6-rocky8-test
  - task: ic_gpdb
    tags: [icw-worker]
    file: gpdb_src/concourse/tasks/ic_gpdb.yml
    image: gpdb6-rocky8-test
    timeout: 24h
    params:
      MAKE_TEST_COMMAND: -k PGOPTIONS='-c gp_interconnect_type=proxy -c optimizer=off' EXTRA_REGRESS_OPTS=--exclude-tests=external_table installcheck-world
      TEST_OS: centos
      CONFIGURE_FLAGS: ((configure_flags))

- name: icw_gporca_icproxy_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_icw_start]
      - get: bin_gpdb
        passed: [gate_icw_start]
      - get: postgres_for_fdw
        params:
          unpack: true
      - get: gpdb6-rocky8-test
  - task: ic_gpdb
    tags: [icw-worker]
    file: gpdb_src/concourse/tasks/ic_gpdb.yml
    image: gpdb6-rocky8-test
    timeout: 24h
    params:
      MAKE_TEST_COMMAND: -k PGOPTIONS='-c gp_interconnect_type=proxy -c optimizer=on' EXTRA_REGRESS_OPTS=--exclude-tests=external_table installcheck-world
      TEST_OS: centos
      CONFIGURE_FLAGS: ((configure_flags))

- name: icw_planner_ictcp_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_icw_start]
      - get: bin_gpdb
        passed: [gate_icw_start]
      - get: postgres_for_fdw
        params:
          unpack: true
      - get: gpdb6-rocky8-test
  - task: ic_gpdb
    tags: [icw-worker]
    file: gpdb_src/concourse/tasks/ic_gpdb.yml
    image: gpdb6-rocky8-test
    timeout: 24h
    params:
      MAKE_TEST_COMMAND: -k PGOPTIONS='-c gp_interconnect_type=tcp -c optimizer=off' installcheck-world
      TEST_OS: centos

- name: icw_mirrorless_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_icw_start]
      - get: bin_gpdb
        passed: [gate_icw_start]
      - get: postgres_for_fdw
        params:
          unpack: true
      - get: gpdb6-rocky8-test
  - task: ic_gpdb
    tags: [icw-worker]
    file: gpdb_src/concourse/tasks/ic_gpdb.yml
    image: gpdb6-rocky8-test
    timeout: 24h
    params:
      MAKE_TEST_COMMAND: -k PGOPTIONS='-c optimizer=on' installcheck-mirrorless
      TEST_OS: centos
      CONFIGURE_FLAGS: ((configure_flags))
      WITH_MIRRORS: false
      BLDWRAP_POSTGRES_CONF_ADDONS:
        - wal_level=minimal
        - max_wal_senders=0
        - max_replication_slots=0
        - wal_keep_segments=0
        - gp_dispatch_keepalives_idle=30
        - gp_dispatch_keepalives_interval=10
        - gp_dispatch_keepalives_count=4

- name: icw_gporca_memory_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_icw_start]
      - get: bin_gpdb
        passed: [gate_icw_start]
      - get: postgres_for_fdw
        params:
          unpack: true
      - get: gpdb6-rocky8-test
  - task: ic_gpdb
    tags: [icw-worker]
    file: gpdb_src/concourse/tasks/ic_gpdb.yml
    image: gpdb6-rocky8-test
    timeout: 24h
    params:
      MAKE_TEST_COMMAND: -k PGOPTIONS='-c optimizer=on' installcheck-world
      TEST_OS: centos
      CONFIGURE_FLAGS: ((configure_flags))
      BLDWRAP_POSTGRES_CONF_ADDONS:
        - optimizer_use_gpdb_allocators=off

- name: unit_tests_gporca_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        passed: [gate_icw_start]
        trigger: true
      - get: gpdb6-rocky8-build
      - get: bin_gpdb
        params:
          skip_download: 'true'
        passed: [ gate_icw_start ]
      - get: bin_gpdb_clients
        params:
          skip_download: 'true'
        passed: [ gate_icw_start ]
      - get: bin_gpdb_sles12
        params:
          skip_download: 'true'
        passed: [ gate_icw_start ]
      - get: bin_gpdb_clients_sles12
        params:
          skip_download: 'true'
        passed: [ gate_icw_start ]
      - get: bin_gpdb_clients_windows
        params:
          skip_download: 'true'
        passed: [ gate_icw_start ]
  - task: unit_tests_gporca
    file: gpdb_src/concourse/tasks/unit_tests_gporca.yml
    image: gpdb6-rocky8-build

- name: gpdb_pitr_rocky8
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            passed: [gate_icw_start]
          - get: bin_gpdb
            passed: [gate_icw_start]
          - get: gpdb6-rocky8-test
    - task: gpdb_pitr
      file: gpdb_src/concourse/tasks/gpdb_pitr.yml
      image: gpdb6-rocky8-test
      params:
        WITH_MIRRORS: true
        TEST_OS: centos
        CONFIGURE_FLAGS: ((configure_flags))

- name: fips_rocky8
  plan:
  - in_parallel:
    - get: gpdb_src
      trigger: true
      passed: [gate_icw_start]
    - get: gpdb_binary
      resource: bin_gpdb
      passed: [gate_icw_start]
    - get: ccp_src
    - get: ccp-image
    - get: terraform.d
      params:
        unpack: true
  - put: terraform
    params:
      action: create
      delete_on_failure: true
      generate_random_name: true
      plugin_dir: ../../terraform.d/plugin-cache/linux_amd64
      terraform_source: ccp_src/google/
      vars:
        PLATFORM: rocky8-fips
        instance_type: n1-standard-2
  - task: gen_cluster
    file: ccp_src/ci/tasks/gen_cluster.yml
    params:
      AWS_ACCESS_KEY_ID: ((tf-machine-access-key-id))
      AWS_SECRET_ACCESS_KEY: ((tf-machine-secret-access-key))
      AWS_DEFAULT_REGION: ((aws-region))
      BUCKET_PATH: clusters-google/
      BUCKET_NAME: ((tf-bucket-name))
      CLOUD_PROVIDER: google
      PLATFORM: rocky8-fips
  - task: gpinitsystem
    file: ccp_src/ci/tasks/gpinitsystem.yml
    params:
      PLATFORM: rocky8-fips
  - task: test_fips
    config:
      platform: linux
      image_resource:
        type: registry-image
        source:
          repository: gcr.io/data-gpdb-public-images/ccp
          tag: "latest"
      inputs:
        - name: ccp_src
        - name: cluster_env_files
      run:
        path: bash
        args:
          - -c
          - |
            set -e

            ccp_src/scripts/setup_ssh_to_cluster.sh
            ssh -t cdw <<EOF
                set -e
                cat /proc/sys/crypto/fips_enabled
                # python regression test for "ERROR:root:code for hash md5 was not found."
                if ! python -c "import hashlib"; then
                    echo "Failed to import hashlib on a FIPS enabled environment."
                    exit 1
                fi
                echo "Successfully imported hashlib on a FIPS enabled environment."
            EOF
    on_success:
      <<: *ccp_destroy
  ensure:
    <<: *set_failed


- name: interconnect_rocky8
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            passed: [gate_icw_start]
          - get: bin_gpdb
            passed: [gate_icw_start]
          - get: gpdb6-rocky8-test
    - task: ic_gpdb
      file: gpdb_src/concourse/tasks/ic_gpdb.yml
      image: gpdb6-rocky8-test
      params:
        MAKE_TEST_COMMAND: -k PGOPTIONS='-c optimizer=off'
          BUILD_TYPE=((rc-build-type)) -C src/test/regress installcheck-icudp
        TEST_OS: centos

- name: icw_extensions_gpcloud_rocky8
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            passed: [gate_icw_start]
            trigger: true
          - get: bin_gpdb
            passed: [gate_icw_start]
          - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
          - task: unit_tests_gpcloud
            file: gpdb_src/concourse/tasks/unit_tests_gpcloud.yml
            image: gpdb6-rocky8-test
            params:
              TARGET_OS: centos
          - task: regression_tests_gpcloud_rocky8
            file: gpdb_src/concourse/tasks/regression_tests_gpcloud.yml
            image: gpdb6-rocky8-test
            params:
              gpcloud_access_key_id: ((gpcloud-access-key-id))
              gpcloud_secret_access_key: ((gpcloud-secret-access-key))
              TARGET_OS: centos
          - task: gpcheckcloud_tests_gpcloud_rocky8
            file: gpdb_src/concourse/tasks/gpcheckcloud_tests_gpcloud.yml
            image: gpdb6-rocky8-test
            params:
              gpcloud_access_key_id: ((gpcloud-access-key-id))
              gpcloud_secret_access_key: ((gpcloud-secret-access-key))
              TARGET_OS: centos

- name: pg_upgrade_rocky8
  ensure:
    <<: *set_failed
  on_success:
    <<: *ccp_destroy
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            passed: [icw_planner_rocky8]
          - get: bin_gpdb
            passed: [icw_planner_rocky8]
          - get: icw_planner_rocky8_dump
            passed: [icw_planner_rocky8]
          - get: ccp_src
          - get: terraform.d
            params:
              unpack: true
    - put: terraform
      params:
        <<: *ccp_default_params
        vars:
          <<: *ccp_default_vars
          instance_type: n1-standard-4
          number_of_nodes: 2
    - task: gen_cluster
      file: ccp_src/ci/tasks/gen_cluster.yml
      params:
        <<: *ccp_gen_cluster_default_params
      input_mapping:
        gpdb_binary: bin_gpdb
    - task: set_gpinitsystem_config
      file: gpdb_src/concourse/tasks/set_gpinitsystem_config.yml
      params:
        GPINITSYSTEM_CONFIG: gpdb_src/concourse/scripts/configurations/pg_upgrade_gpinitsystem_config
    - task: gpinitsystem
      file: ccp_src/ci/tasks/gpinitsystem.yml
      params:
        PLATFORM: rocky8
    - task: test_upgrade
      file: gpdb_src/concourse/tasks/test_upgrade.yml
      input_mapping:
        sqldump: icw_planner_rocky8_dump
      params:
        NUMBER_OF_NODES: 2

- name: gpexpand_rocky8
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            params:
              submodules:
                - gpMgmt/bin/pythonSrc/ext
            passed: [icw_planner_rocky8]
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [icw_planner_rocky8]
          - get: ccp_src
          - get: ccp-image
          - get: icw_planner_rocky8_dump
            passed: [icw_planner_rocky8]
          - get: terraform.d
            params:
              unpack: true
    - put: terraform
      params:
        <<: *ccp_default_params
        vars:
          <<: *ccp_default_vars
          instance_type: n1-standard-4
          number_of_nodes: 5
    - task: gen_cluster
      file: ccp_src/ci/tasks/gen_cluster.yml
      params:
        <<: *ccp_gen_cluster_default_params
    - task: pre_run_test_setup
      file: gpdb_src/concourse/tasks/setup_for_gpexpand_to_make_new_gpdb.yml
      image: ccp-image
      input_mapping: {sqldump: icw_planner_rocky8_dump}
      params:
        SUDO_CDW_USERNAME: rocky
    - task: run_tests
      file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
      params:
        BEHAVE_FLAGS: --tags=gpexpand
        SUDO_CDW_USERNAME: rocky
      image: ccp-image
      on_success:
        <<: *ccp_destroy
  ensure:
    <<: *set_failed

- name: gate_icw_end
  plan:
  - in_parallel:
      steps:
      - get: bin_gpdb
        passed:
        - icw_gporca_rocky8
        - icw_gporca_icproxy_rocky8
        - icw_planner_icproxy_rocky8
        - icw_planner_ictcp_rocky8
        - icw_mirrorless_rocky8
        - icw_gporca_memory_rocky8
        # Not support enable fips on ubuntu20.04
        - fips_rocky8
        - unit_tests_gporca_rocky8
        - gpdb_pitr_rocky8
        - interconnect_rocky8
        - icw_extensions_gpcloud_rocky8
        - gpexpand_rocky8
        - pg_upgrade_rocky8
      - get: gpdb_src
        params:
          skip_download: 'true'
        passed:
        - icw_gporca_rocky8
        - icw_gporca_icproxy_rocky8
        - icw_planner_icproxy_rocky8
        - icw_planner_ictcp_rocky8
        - icw_mirrorless_rocky8
        - icw_gporca_memory_rocky8
        # Not support enable fips on ubuntu20.04
        - fips_rocky8
        - unit_tests_gporca_rocky8
        - gpdb_pitr_rocky8
        - interconnect_rocky8
        - icw_extensions_gpcloud_rocky8
        - gpexpand_rocky8
        - pg_upgrade_rocky8
        trigger: true
      - get: bin_gpdb_clients
        params:
          skip_download: 'true'
        passed: [ unit_tests_gporca_rocky8 ]
      - get: bin_gpdb_sles12
        params:
          skip_download: 'true'
        passed: [ unit_tests_gporca_rocky8 ]
      - get: bin_gpdb_clients_sles12
        params:
          skip_download: 'true'
        passed: [ unit_tests_gporca_rocky8 ]
      - get: bin_gpdb_clients_windows
        params:
          skip_download: 'true'
        passed: [ unit_tests_gporca_rocky8 ]
  - put: bin_gpdb_icw_green
    params:
      file: bin_gpdb/bin_gpdb.tar.gz

## ======================================================================
##   ____ _     ___
##  / ___| |   |_ _|
## | |   | |    | |
## | |___| |___ | |
##  \____|_____|___|
## ======================================================================

- name: gate_cli_start
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        params:
          skip_download: 'true'
        passed:
        - gate_compile_end
        trigger: true
      - get: bin_gpdb
        params:
          skip_download: 'true'
        passed:
        - gate_compile_end
      - get: binary_swap_gpdb_rocky8
        params:
          skip_download: 'true'
        passed:
          - gate_compile_end

- name: check_rocky8
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_cli_start]
      - get: bin_gpdb
        passed: [gate_cli_start]
      - get: gpdb6-rocky8-test
  - task: check_rocky8
    file: gpdb_src/concourse/tasks/gpMgmt_check_gpdb.yml
    image: gpdb6-rocky8-test
    params:
      TEST_OS: centos

- name: gpmovemirrors_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                number_of_nodes: 4
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpmovemirrors_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpmovemirrors --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpmovemirrors_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpmovemirrors --tags=~concourse_cluster,demo_cluster
              
- name: gppkg_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gppkg_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gppkg --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gppkg_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gppkg --tags=~concourse_cluster,demo_cluster
              
- name: analyzedb_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: analyzedb_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=analyzedb --tags=~concourse_cluster,demo_cluster
              
- name: gpreload_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpreload_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpreload --tags=~concourse_cluster,demo_cluster
              
- name: gpinitsystem_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpinitsystem_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpinitsystem --tags=~concourse_cluster,demo_cluster
              
- name: gpstate_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpstate_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpstate --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpstate_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpstate --tags=~concourse_cluster,demo_cluster
              
- name: replication_slots_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: replication_slots_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=replication_slots --tags=~concourse_cluster,demo_cluster
              
- name: gpactivatestandby_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpactivatestandby_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpactivatestandby --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpactivatestandby_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpactivatestandby --tags=~concourse_cluster,demo_cluster
              
- name: gpinitstandby_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpinitstandby_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpinitstandby --tags=~concourse_cluster,demo_cluster
              
- name: gp_bash_functions.sh_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gp_bash_functions.sh_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gp_bash_functions.sh --tags=~concourse_cluster,demo_cluster
              
- name: gpcheckcat_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpcheckcat_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpcheckcat --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpcheckcat_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpcheckcat --tags=~concourse_cluster,demo_cluster
              
- name: gpcheckperf_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpcheckperf_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              SUDO_ACCESS_ON_HOSTS: 1
              SUDO_CDW_USERNAME: rocky
              BEHAVE_FLAGS: --tags=gpcheckperf --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpcheckperf_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpcheckperf --tags=~concourse_cluster,demo_cluster
              
- name: gprecoverseg_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                number_of_nodes: 3
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gprecoverseg_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              SUDO_ACCESS_ON_HOSTS: 1
              SUDO_CDW_USERNAME: rocky
              BEHAVE_FLAGS: --tags=gprecoverseg --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gprecoverseg_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gprecoverseg --tags=~concourse_cluster,demo_cluster
              
- name: gprecoverseg_newhost_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                number_of_nodes: 7
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - get: alpine-docker
          - task: reserve_spare_hosts
            image: alpine-docker
            config:
              platform: linux
              inputs:
                - name: cluster_env_files
              outputs:
                - name: cluster_env_files
              run:
                path: sh
                args:
                  - -exc
                  - |
                    # modify the hostfile_init used by gpinitsystem to exclude the last two hosts, so they are spares
                    cp cluster_env_files/hostfile_init cluster_env_files/hostfile_init_orig
                    head -n -2 cluster_env_files/hostfile_init_orig > cluster_env_files/hostfile_init
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gprecoverseg_newhost_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              SUDO_ACCESS_ON_HOSTS: 1
              SUDO_CDW_USERNAME: rocky
              BEHAVE_FLAGS: --tags=gprecoverseg_newhost --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gprecoverseg_newhost_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gprecoverseg_newhost --tags=~concourse_cluster,demo_cluster
              
- name: gpaddmirrors_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                number_of_nodes: 4
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpaddmirrors_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpaddmirrors --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpaddmirrors_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpaddmirrors --tags=~concourse_cluster,demo_cluster
              
- name: gpconfig_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpconfig_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpconfig --tags=concourse_cluster
              LC_CTYPE: en_US.UTF-8
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpconfig_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpconfig --tags=~concourse_cluster,demo_cluster
              LC_CTYPE: en_US.UTF-8
- name: gpssh-exkeys_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                number_of_nodes: 4
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpssh-exkeys_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpssh-exkeys --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpssh-exkeys_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpssh-exkeys --tags=~concourse_cluster,demo_cluster
              
- name: gpstart_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpstart_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpstart --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpstart_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpstart --tags=~concourse_cluster,demo_cluster
              
- name: gpstop_rocky8
  plan:
    - in_parallel:
        steps:
        - get: gpdb_src
          trigger: true
          params:
            submodules:
              - gpMgmt/bin/pythonSrc/ext
          passed: [gate_cli_start]
        - get: gpdb6-rocky8-test
    - in_parallel:
        steps:
        - do:
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: terraform.d
            params:
              unpack: true
          - put: terraform
            params:
              <<: *ccp_default_params
              vars:
                <<: *ccp_default_vars
                instance_type: n1-standard-2
                
          - task: gen_cluster
            file: ccp_src/ci/tasks/gen_cluster.yml
            params:
              <<: *ccp_gen_cluster_default_params
          - task: gpinitsystem
            file: ccp_src/ci/tasks/gpinitsystem.yml
            params:
              PLATFORM: rocky8
          - task: gpstop_concourse_cluster_tests
            file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
            image: ccp-image
            params:
              BEHAVE_FLAGS: --tags=gpstop --tags=concourse_cluster
              
            on_success:
              <<: *ccp_destroy
            ensure:
              <<: *set_failed
        - do:
          - get: bin_gpdb
            passed: [gate_cli_start]
            trigger: 
          - task: gpstop_demo_cluster_tests
            file: gpdb_src/concourse/tasks/behave_gpdb.yml
            image: gpdb6-rocky8-test
            params:
              BEHAVE_FLAGS: --tags=gpstop --tags=~concourse_cluster,demo_cluster
              

- name: cli_cross_subnet_rocky8
  plan:
    - in_parallel:
      - get: gpdb_src
        trigger: true
        params:
          submodules:
            - gpMgmt/bin/pythonSrc/ext
        passed: [gate_cli_start]
      - get: gpdb6-rocky8-test
      - get: gpdb_binary
        resource: bin_gpdb
        passed: [gate_cli_start]
      - get: ccp_src
      - get: ccp-image
      - get: alpine-docker
      - get: terraform.d
        params:
          unpack: true
    - task: generate-ssh-keys
      image: alpine-docker
      config:
        platform: linux
        outputs:
          - name: ssh-extra-key
        run:
          path: sh
          args:
            - -exc
            - |
              apk add --update --no-progress openssh-client openssl
              ssh-keygen -b 4096 -t rsa -m PEM -f ssh-extra-key/key -N "" -C ""
              openssl rsa -in ssh-extra-key/key -pubout -out ssh-extra-key/key.pem
              sed -i 's/*//;s/ *$//' ssh-extra-key/key.pub
    - in_parallel:
      - do:
        - put: terraform_1
          params:
            <<: *ccp_default_params
            vars:
              <<: *ccp_default_vars
              instance_type: n1-standard-2
              subnet: dynamic
              cluster_suffix: '-1'
              custom_ssh_key: "/tmp/build/put/ssh-extra-key/key"
        - task: gen_cluster_1
          file: ccp_src/ci/tasks/gen_cluster.yml
          params:
            <<: *ccp_gen_cluster_default_params
          input_mapping:
            terraform: terraform_1
          output_mapping:
            cluster_env_files: cluster_1
      - do:
        - put: terraform_2
          params:
            <<: *ccp_default_params
            vars:
              <<: *ccp_default_vars
              instance_type: n1-standard-2
              subnet: toolshed
              cluster_suffix: '-2'
              custom_ssh_key: "/tmp/build/put/ssh-extra-key/key"
        - task: gen_cluster_2
          file: ccp_src/ci/tasks/gen_cluster.yml
          params:
            <<: *ccp_gen_cluster_default_params
          input_mapping:
            terraform: terraform_2
          output_mapping:
            cluster_env_files: cluster_2
    - task: exchange_keys
      config:
        image_resource:
          type: registry-image
          source:
            repository: centos
            tag: 7
        platform: linux
        inputs:
          - name: cluster_1
          - name: cluster_2
        run:
          path: sh
          args:
            - -exc
            - |
              yum install --quiet -y openssh-clients
              opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i cluster_1/private_key.pem"
              while read -r ip host extra; do
                  scp $opts cluster_2/.ssh/*private_key.pem gpadmin@"$ip":~/.ssh/
                  ssh $opts gpadmin@"$ip" -- bash -c "cat - >> ~/.ssh/config && chmod 0600 ~/.ssh/config" < cluster_2/.ssh/config
                  ssh $opts rocky@"$ip" -- "sudo bash -c 'cat - >> /etc/hosts'" < cluster_2/etc_hostfile
                  ssh $opts gpadmin@"$ip" -- bash -c "cat - >> ~/.ssh/known_hosts" < cluster_2/.ssh/known_hosts
              done < cluster_1/etc_hostfile

              opts="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i cluster_2/private_key.pem"
              while read -r ip host extra; do
                  scp $opts cluster_1/.ssh/*private_key.pem gpadmin@"$ip":~/.ssh/
                  ssh $opts gpadmin@"$ip" -- bash -c "cat - >> ~/.ssh/config && chmod 0600 ~/.ssh/config" < cluster_1/.ssh/config
                  ssh $opts rocky@"$ip" -- "sudo bash -c 'cat - >> /etc/hosts'" < cluster_1/etc_hostfile
                  ssh $opts gpadmin@"$ip" -- bash -c "cat - >> ~/.ssh/known_hosts" < cluster_1/.ssh/known_hosts
              done < cluster_2/etc_hostfile
    - task: combine_cluster_config_files
      image: alpine-docker
      config:
        platform: linux
        inputs:
          - name: cluster_1
          - name: cluster_2
        outputs:
          - name: cluster_env_files
        run:
          path: sh
          args:
            - -exc
            - |
              cp -r cluster_1/* cluster_env_files
              cp -r cluster_1/.ssh cluster_env_files
              cat cluster_2/hostfile_all >> cluster_env_files/hostfile_all
              cat cluster_2/etc_hostfile >> cluster_env_files/etc_hostfile
              cat cluster_2/hostfile_init >> cluster_env_files/hostfile_init

              cp cluster_2/.ssh/*.pem cluster_env_files/.ssh
              cat cluster_2/.ssh/known_hosts >> cluster_env_files/.ssh/known_hosts
              cat cluster_2/.ssh/config >> cluster_env_files/.ssh/config
              sed -i '/^Host cdw-1/ s/$/ cdw/' cluster_env_files/.ssh/config
    - task: gpinitsystem
      file: ccp_src/ci/tasks/gpinitsystem.yml
      params:
        GPINIT_STANDBY_COORDINATOR: '-s cdw-2'
        PLATFORM: rocky8
    - task: cross_subnet_tests
      file: gpdb_src/concourse/tasks/run_behave_on_ccp_cluster.yml
      image: ccp-image
      params:
        BEHAVE_FLAGS: --tags=cross_subnet
        TEST_NAME: cross_subnet
  on_success:
    <<: *ccp_destroy_two_clusters
  ensure:
    <<: *set_failed_two_clusters

- name: resource_group_rocky8
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            passed: [gate_cli_start]
          - get: gpdb_binary
            resource: bin_gpdb
            passed: [gate_cli_start]
          - get: ccp_src
          - get: ccp-image
          - get: binary_swap_gpdb
            passed: [gate_cli_start]
            resource: binary_swap_gpdb_rocky8
          - get: terraform.d
            params:
              unpack: true
    - put: terraform
      params:
        <<: *ccp_default_params
        vars:
          <<: *ccp_default_vars
          instance_type: n1-standard-2
    - task: gen_cluster
      file: ccp_src/ci/tasks/gen_cluster.yml
      params:
        <<: *ccp_gen_cluster_default_params
    - task: gpinitsystem
      file: ccp_src/ci/tasks/gpinitsystem.yml
      params:
        PLATFORM: rocky8
    - task: run_tests
      file: gpdb_src/concourse/tasks/ic_gpdb_resgroup.yml
      image: ccp-image
      params:
        TEST_OS: rocky8
      on_success:
        <<: *ccp_destroy
  ensure:
    <<: *set_failed

- name: gate_cli_end
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            trigger: true
            params:
              skip_download: 'true'
            passed:
            - cli_cross_subnet_rocky8
            - gpmovemirrors_rocky8
            - gppkg_rocky8
            - analyzedb_rocky8
            - gpreload_rocky8
            - gpinitsystem_rocky8
            - gpstate_rocky8
            - replication_slots_rocky8
            - gpactivatestandby_rocky8
            - gpinitstandby_rocky8
            - gp_bash_functions.sh_rocky8
            - gpcheckcat_rocky8
            - gpcheckperf_rocky8
            - gprecoverseg_rocky8
            - gprecoverseg_newhost_rocky8
            - gpaddmirrors_rocky8
            - gpconfig_rocky8
            - gpssh-exkeys_rocky8
            - gpstart_rocky8
            - gpstop_rocky8
            - check_rocky8
            - resource_group_rocky8
          - get: bin_gpdb
            params:
              skip_download: 'true'
            passed:
            - cli_cross_subnet_rocky8
            - gpmovemirrors_rocky8
            - gppkg_rocky8
            - analyzedb_rocky8
            - gpreload_rocky8
            - gpinitsystem_rocky8
            - gpstate_rocky8
            - replication_slots_rocky8
            - gpactivatestandby_rocky8
            - gpinitstandby_rocky8
            - gp_bash_functions.sh_rocky8
            - gpcheckcat_rocky8
            - gpcheckperf_rocky8
            - gprecoverseg_rocky8
            - gprecoverseg_newhost_rocky8
            - gpaddmirrors_rocky8
            - gpconfig_rocky8
            - gpssh-exkeys_rocky8
            - gpstart_rocky8
            - gpstop_rocky8
            - check_rocky8
            - resource_group_rocky8
          - get: binary_swap_gpdb_rocky8
            params:
              skip_download: 'true'
            passed:
            - resource_group_rocky8

 # end cli test_sections

## ======================================================================
##     _        _
##    / \      / \
##   / _ \    / _ \
##  / ___ \  / ___ \
## /_/   \_\/_/   \_\
## ======================================================================
- name: gate_advanced_analytics_start
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        params:
          skip_download: 'true'
        passed:
        - gate_compile_end
        trigger: true
      - get: bin_gpdb
        params:
          skip_download: 'true'
        passed:
        - gate_compile_end

- name: madlib_build_gppkg_rocky8
  plan:
  - in_parallel:
      steps:
      - get: madlib_src
      - get: madlib_ci
      - get: cmake_tar
      - get: pyxb
      - get: eigen
      - get: boost
      - get: gpdb_src
        trigger: true
        passed: [gate_advanced_analytics_start]
      - get: bin_gpdb
        passed: [gate_advanced_analytics_start]
      - get: gpdb6-rocky8-test
  - in_parallel:
    - task: build_madlib_gppkg_from_source_rocky8
      file: madlib_ci/concourse/tasks/madlib_build_gppkg_from_source.yml
      image: gpdb6-rocky8-test
      output_mapping:
        madlib_master_artifacts: madlib_master_artifacts_rocky8
      params:
        TEST_OS: rocky8
        DB_TYPE: gpdb6
        CMAKE_BUILD_TYPE: Release
  - in_parallel:
    - put: madlib_gppkg_rocky8
      params:
        file: madlib_master_artifacts_rocky8/madlib-*.gppkg
- name: madlib_test_planner_rocky8
  old_name: MADlib_Test_planner_rocky8
  plan:
  - in_parallel:
      steps:
      - get: madlib_ci
        passed: [madlib_build_gppkg_rocky8]
      - get: gpdb_src
        trigger: true
        passed: [madlib_build_gppkg_rocky8]
      - get: bin_gpdb
        passed: [madlib_build_gppkg_rocky8]
      - get: gpdb6-rocky8-test
      - get: madlib_gppkg
        resource: madlib_gppkg_rocky8
        passed: [madlib_build_gppkg_rocky8]
  - task: madlib_test
    file: madlib_ci/concourse/tasks/madlib_test_gppkg.yml
    image: gpdb6-rocky8-test
    params:
      TEST_OS: rocky8
      ORCA: "off"
      DBVER: gpdb6

- name: madlib_test_orca_rocky8
  old_name: MADlib_Test_orca_rocky8
  plan:
  - in_parallel:
      steps:
      - get: madlib_ci
        passed: [madlib_build_gppkg_rocky8]
      - get: gpdb_src
        trigger: true
        passed: [madlib_build_gppkg_rocky8]
      - get: bin_gpdb
        passed: [madlib_build_gppkg_rocky8]
      - get: gpdb6-rocky8-test
      - get: madlib_gppkg
        resource: madlib_gppkg_rocky8
        passed: [madlib_build_gppkg_rocky8]
  - task: madlib_test
    file: madlib_ci/concourse/tasks/madlib_test_gppkg.yml
    image: gpdb6-rocky8-test
    params:
      TEST_OS: rocky8
      ORCA: "on"
      DBVER: gpdb6

- name: gate_advanced_analytics_end
  plan:
    - in_parallel:
        steps:
          - get: gpdb_src
            params:
              skip_download: 'true'
            passed:
              - madlib_test_orca_rocky8
              - madlib_test_planner_rocky8
            trigger: true
          - get: bin_gpdb
            params:
              skip_download: 'true'
            passed:
              - madlib_test_orca_rocky8
              - madlib_test_planner_rocky8


## ======================================================================
##  ____      _
## |  _ \ ___| | ___  __ _ ___  ___
## | |_) / _ \ |/ _ \/ _` / __|/ _ \
## |  _ <  __/ |  __/ (_| \__ \  __/
## |_| \_\___|_|\___|\__,_|___/\___|
## ======================================================================
- name: gate_release_candidate_start
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        params:
          skip_download: 'true'
        passed:
        - gate_icw_end
        - gate_cli_end
        - gate_advanced_analytics_end
      - get: bin_gpdb
        params:
          skip_download: 'true'
        passed:
        - gate_icw_end
        - gate_cli_end
        - gate_advanced_analytics_end
      - get: bin_gpdb_clients
        params:
          skip_download: 'true'
        passed:
        - gate_icw_end
      - get: bin_gpdb_sles12
        params:
          skip_download: 'true'
        passed: [ gate_icw_end ]
      - get: bin_gpdb_clients_sles12
        params:
          skip_download: 'true'
        passed: [ gate_icw_end ]
      - get: bin_gpdb_clients_windows
        params:
          skip_download: 'true'
        passed: [ gate_icw_end ]

- name: release_candidate
  old_name: Release_Candidate
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_release_candidate_start]
      - get: bin_gpdb
        passed: [gate_release_candidate_start]
      - get: bin_gpdb_clients
        passed: [gate_release_candidate_start]
      - get: bin_gpdb_clients_windows
        passed: [gate_release_candidate_start]
      - get: bin_gpdb_sles12
        passed: [ gate_release_candidate_start ]
      - get: bin_gpdb_clients_sles12
        passed: [gate_release_candidate_start]
      - get: gpdb6-rocky8-build
  - in_parallel:
      steps:
      - task: rename_rc_artifacts
        image: gpdb6-rocky8-build
        config:
          platform: linux
          inputs:
            - name: gpdb_src
            - name: bin_gpdb
            - name: bin_gpdb_clients
            - name: bin_gpdb_clients_windows
            - name: bin_gpdb_sles12
            - name: bin_gpdb_clients_sles12
          outputs:
            - name: release_candidates
          params:
            RC_BUILD_TYPE_GCS: ((rc-build-type-gcs))
          run:
            path: bash
            args:
              - -ec
              - |
                gpdb_semver=$(gpdb_src/getversion | cut -d' ' -f1)
                cp -v bin_gpdb/bin_gpdb.tar.gz release_candidates/server-rc-${gpdb_semver}-rhel8_x86_64${RC_BUILD_TYPE_GCS}.tar.gz
                cp -v bin_gpdb_clients/bin_gpdb_clients.tar.gz release_candidates/clients-rc-${gpdb_semver}-rhel8_x86_64${RC_BUILD_TYPE_GCS}.tar.gz
                cp -v bin_gpdb_clients_sles12/bin_gpdb_clients.tar.gz release_candidates/clients-rc-${gpdb_semver}-sles12_x86_64${RC_BUILD_TYPE_GCS}.tar.gz
                pushd bin_gpdb_clients_windows
                tar xzvf *.tar.gz
                popd
                cp bin_gpdb_clients_windows/greenplum-clients-x86_64.msi release_candidates/clients-rc-${gpdb_semver}-windows_x86_64${RC_BUILD_TYPE_GCS}.msi
      - task: verify_gpdb_versions
        file: gpdb_src/concourse/tasks/verify_gpdb_versions.yml
      - task: tar_git_repo
        file: gpdb_src/concourse/tasks/tar_git_repo.yml
        params:
          SERVER_SRC_RC_PREFIX: ""
          RC_BUILD_TYPE_GCS: ((rc-build-type-gcs))
  - in_parallel:
      steps:
      - put: bin_gpdb_rocky8_rc
        params:
          file: "release_candidates/server-rc-*rhel8*.tar.gz"
      - put: bin_gpdb_clients_rocky8_rc
        params:
          file: "release_candidates/clients-rc-*rhel8*.tar.gz"
      - put: bin_gpdb_clients_windows_rc
        params:
          file: "release_candidates/clients-rc-*-windows*.msi"
      - put: bin_gpdb_clients_sles12_rc
        params:
          file: "release_candidates/clients-rc-*sles12*.tar.gz"
      - put: server_src_rc
        params:
          file: "server_tar/*server-src-rc-*.tar.gz"

- name: build_release_candidate_rpms
  old_name: Build_Release_Candidate_RPMs
  plan:
  - in_parallel:
      steps:
      - get: gpdb_src
        trigger: true
        passed: [gate_release_candidate_start]
      - get: bin_gpdb
        passed: [gate_release_candidate_start]
      - get: gpdb6-rocky8-build
      - get: greenplum-database-release
      - get: license_file
  - task: create_gpdb_rpm_package_rocky8
    file: greenplum-database-release/ci/concourse/tasks/build-gpdb-rpm.yml
    image: gpdb6-rocky8-build
    output_mapping:
      gpdb_rpm_installer: gpdb_rpm_rocky8
    params:
      PLATFORM: rocky8
      GPDB_NAME: greenplum-db-6
      GPDB_RELEASE: 1
      GPDB_LICENSE: Pivotal Software EULA
      GPDB_URL: https://github.com/greenplum-db/gpdb
      GPDB_OSS: false
  - task: rename_rc_artifacts
    image: gpdb6-rocky8-build
    config:
      platform: linux
      inputs:
        - name: gpdb_src
        - name: gpdb_rpm_rocky8
      outputs:
        - name: renamed_gpdb_rpm_rocky8
      params:
        RC_BUILD_TYPE_GCS: ((rc-build-type-gcs))
      run:
        path: sh
        args:
          - -exc
          - |
            gpdb_semver=$(gpdb_src/getversion | cut -d' ' -f1)
            cp -v gpdb_rpm_rocky8/*.rpm renamed_gpdb_rpm_rocky8/greenplum-db-${gpdb_semver}-rhel8-x86_64${RC_BUILD_TYPE_GCS}.rpm
  - in_parallel:
      steps:
      - put: gpdb_rpm_installer_rocky8
        params:
          file: renamed_gpdb_rpm_rocky8/*.rpm
